<template>
  <view class="content">
    <!-- 顶部任务栏start -->
      <u-sticky bgColor="#fff">
      <u-tabs 
      :list="list1" 
      @click="click" 
      lineColor="#f25c4d">
      </u-tabs>
       </u-sticky>
       <!-- 顶部任务栏end -->
       <index-list :list="list"></index-list>
  </view>
</template>

<script>
  export default {
    name: 'index',
    data() {
      return {
        list1: [{
          name: '待提货',
           badge: {isDot: true}
        }, {
          name: '在途',
        }, {
          name: '已完成'
        }],
        query:{
          status:'1', //发请求相关数据，1代表待提货
          page:1, //页面
          pagesize:20//页面大小
        },
        list:[],
        
      }
   
    },
    onLoad() {
   this.getList()
    },
methods: {
  click(e){
  console.log(e)
  if(e.name === '待提货'){
    this.query.status ='1'
    this.getList()
  }else if(e.name ==='在途'){
    this.query.status ='2'
    this.getList()
  }else{
    this.query.status ='6'
    this.getList()
  }
},
 async getList(){
  const res = await uni.$http.get('/tasks/list',{
    ...this.query
  })
  console.log(res)
  this.list = res.data.data.items
}
    }
  }
</script>

<style lang="scss">
  
.yi{
  font-weight: 700;
}
</style>